package com.taobao.modules.redis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import redis.clients.jedis.Jedis;

public class RedisUtile {

	public static void main(String[] args) throws Exception {

		Jedis redis = new Jedis("10.232.37.55", 6379);

		redis.hset("yyweb", "music", "m.yy.com");
		redis.hset("yyweb", "mall", "mai.yy.com");
		redis.hset("yyweb", "duowan", "www.duowan.com");
		List<?> list = redis.hmget("yyweb", "music", "mall", "duowan");
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}

		Map<String, String> map = new HashMap<String, String>();
		map.put("uid", "10000");
		map.put("username", "chenxu");
		redis.hmset("hash", map);
		System.out.println(redis.hget("hash", "username"));

		Map<String, String> maps = redis.hgetAll("hash");
		for (Map.Entry entry : maps.entrySet()) {
			System.out.print(entry.getKey() + ":" + entry.getValue() + "\t");
		}

	}
}
